Option Strict On
Option Explicit On 

Imports TreeCreeper01Interfaces

Public Module cUniqueKeyUtilities

    Private pCounter As Integer

    Friend Sub AddPlantToPlantList(ByVal PlantList As IPlantList, ByVal GroupingInteger As Integer, ByVal Species As ITaxonomicSpecies, _
        ByVal XCoordinate As Double, ByVal YCoordinate As Double, ByVal CanBeRandomized As Boolean)

        Dim PlantUniqueKey As String
        Dim SpeciesUniqueKey As String
        SpeciesUniqueKey = Species.UniqueKey

        ' we add the count of existing items in the list to get fully unique ky, even if species and coordinates are the same
        PlantUniqueKey = SpeciesUniqueKey & " " & XCoordinate & " " & YCoordinate & "/" & (PlantList.Count + 1)
        pCounter += 1
        PlantList.AddPlant(GroupingInteger, PlantUniqueKey, pCounter, XCoordinate, YCoordinate, Species, True, CanBeRandomized) ' short ids get applied later on

    End Sub



    ' should always be unique, throws error if duplicates are tried
    Friend Sub AddNonSpatialListFilterItemToListFilter(ByVal ListFilter As IListFilter, ByVal SpeciesUniqueKey As String, ByVal ItemValue As Double)
        ListFilter.AddListFilterItem(SpeciesUniqueKey, ItemValue)
    End Sub



End Module
